<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>人事管理--收入证明流程</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">


     <link rel="stylesheet" href="css/zhubijie/zhubijie.css" type="text/css"></link>
     <link rel="stylesheet" href="easyui/themes/icon.css" type="text/css"></link>
	 <link rel="stylesheet" href="easyui/themes/default/easyui.css" type="text/css"></link>
	 <script type="text/javascript" src="easyui/jquery-1.8.3.js"></script>
	 <script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
	 <style type="text/css">
	 body{background:url("images/zhubijie/bg.png");}
	 </style>
     <script type="text/javascript">
      var dname;
      $(function(){
	$.post("dept/findById.do","id="+$("#deptId").val(),function(data){
					dname= data.deptname;
					init();
	  			},"json");
			$.post("dept/findById.do","id="+$("#deptId").val(),function(data){
	  				$("#deptmanagerid").val(data.deptmanagerid);	  	  				  	  			
  				$.post("users/findById.do","id="+$("#deptmanagerid").val(),function(data){
  	  				$("#deptmanagername").val(data.name);	  	  				
  	  			},"json");
			},"json");
			
	
	});
     function init(){
	  		$("#dg").datagrid({	  		
	  			url:"income/findAll.do?id="+$("#applyid").val(),
	  			striped:true,	  			
	  			rownumbers:true,
	  			pagination:true,
	  			pageList:[10,20,50],
	  			columns:[[{
	  				title:"姓名",
	  				field:"name",
	  				width:100,
	  				align:"right",
	  			},{
	  				title:"所属部门",
	  				field:"deptid",
	  				width:100,
	  				align:"center",
	  				formatter:function (value){
          					return dname;
	  				}
	  			},{
	  				title:"申请日期",
	  				field:"dates",
	  				width:100,
	  				align:"right",
	  				formatter:date
	  			},{
	  				title:"申请原因 ",
	  				field:"remark",
	  				width:100,
	  				align:"right"
	  			},{
	  				title:"当前单据的状态",
	  				field:"status",
	  				width:100,
	  				align:"right",
	  				formatter:function (value){
        					if(value==1){
        						return "待审核";
        					}else if(value==2){
        						return "审核中";
        					}else if(value==3){
        						return "待审核";
        					}else if(value==4){
        						return "审核通过";
        					}else if(value==5){
        						return "已拒绝";
        					}else if(value==6){
        						return "已打回";
        					}
        				}
	  			},{
	  				title:"操作",
	  				field:"id",
	  				width:115,
	  				align:"right",
	  				formatter:function (value,row,index){
						return "<a onclick='del("+row.id+")' href='javascript:void(0)'>删除</a>";
					}	  				
	  			}]]
	  		});
	  	};
	  		
/*删除*/	
	  	function del(value){
			$.messager.confirm("提示框", "你确定要删除吗?",function(r){
				if(r){
					var data = "id="+value;
					$.post(
		  				"income/delete.do",
		  				data,
		  				function(data){
		  				alert(data);
		  				$("#dg").datagrid("reload");
		  				},
		  				"text"
		  			);
				}
			});
		};
		function date(value){
		return value.year+1900+"-"
		+(value.month+1)+"-"+value.date;
	};

</script>
 <c:if test="${message!=null }">
	<script>
		alert('${message}');
	</script>
 </c:if>
</head>

<body>
	<div id="mainbody">
		<p>
			<img src="images/zhubijie/u9.png"></img>&nbsp;&nbsp;<span>人事管理</span>
		</p>
		<div class="title">收入证明流程</div>
		<table id="dg"></table>
    	<div class="content">
    	<form method="post" action="income/add.do">
			<table cellpadding="0" cellspacing="0" id="dlg" style="height:220px">
				<tr>
					<td>姓名</td>
					<td><input type="text" class="i1" value="${user.name}" name="name" id="name" readonly="readonly"/></td>

				</tr>
				<tr>
					<td>部门：</td>
					<td>
					<input type="hidden" class="i2" value="${user.id}" name="deptid" id="deptid" readonly="readonly" />
	 				<input type="text" class="i2" value="${user.deptname}" name="deptname" id="deptname" readonly="readonly" /></td>

				</tr>
				<tr>
					<td>申请时间：</td>
					<td><input type="text" name="dates" id="dates" /></td>

				</tr>
 				<tr>
					<td>申请事由：</td>
					<td><textarea name="remark" id="remark"></textarea>
					</td>

				</tr>
	<tr>
		<td>申请人：</td>
		<td>
			<input class="input-text" type="text" id="applyname" name="applyname" value="${user.name}" readonly="readonly"/>
			<input class="input-text" type="hidden" id="applyid" name="applyid" value="${user.id}"/>
		</td>	
	</tr>
                <tr>
					<td>下一步处理人：</td>
					<td><input class="input-text" type="hidden" id="deptId" name="deptId" value="${user.deptid}" />
						<input class="input-text" type="hidden" id="deptmanagerid" name="deptmanagerid" value=""/>
						<input class="input-text" type="text" id="deptmanagername" name="deptmanagername" value="" readonly="readonly"/>
	    			</td>	

				</tr>
		</table>
			<input class="button" type="submit" id="submit" name="submit" value="确定" />
			<input class="button" type="reset" id="reset" name="reset" value="取消" />
		</form>
		</div>
	</div>
</body>
</html>
